package com.lds.memory.kafka.consumer.parallel;

import com.lds.memory.kafka.consumer.IConsumer;

public class ConsumerTask implements Runnable {
    private volatile boolean shutdown = false;
    private final IConsumer consumer;

    public ConsumerTask(IConsumer consumer) {
        this.consumer = consumer;
    }

    public void shutdown() {
        shutdown = true;
    }

    @Override
    public void run() {
        while (!shutdown) {
            consumer.consumer();
        }

        System.out.println("线程【"+Thread.currentThread().getName()+"】正常退出");
    }
}
